package com.yuejie.musicai.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yuejie.musicai.beans.ScoreInfo;
import com.yuejie.musicai.services.impl.ScoreServiceImpl;

@Controller
public class ScoreController {
	
	@Autowired
	ScoreServiceImpl scoreserviceimpl;
	
	/**
	 * 获取Video当前分数
	 * @param user
	 * @param videoid
	 * @return
	 */
	@RequestMapping(value = "/score/query")
	public @ResponseBody ScoreInfo scorequery(@RequestParam String user, @RequestParam String videoid){
		return scoreserviceimpl.query(user, videoid);
	}
	
	/**
	 * 顶video操作
	 * @param user
	 * @param videoid
	 * @return
	 */
	@RequestMapping(value = "/score/update_like")
	public @ResponseBody ScoreInfo score_like(@RequestParam String user, @RequestParam String videoid){
		return scoreserviceimpl.update_like(user, videoid);
	}
	
	
	/**
	 * 踩video操作
	 * @param user
	 * @param videoid
	 * @return
	 */
	@RequestMapping(value = "/score/update_unlike")
	public @ResponseBody ScoreInfo score_unlike(@RequestParam String user, @RequestParam String videoid){
		return scoreserviceimpl.updaten_unlike(user, videoid);
	}

}
